package com.cloud.servicegreyrelease2.service.impl;

import com.cloud.servicegreyrelease2.dao.GreySettingMapper;
import com.cloud.servicegreyrelease2.dao.OnlineSettingMapper;
import com.cloud.servicegreyrelease2.entity.GreySetting;
import com.cloud.servicegreyrelease2.entity.OnlineSetting;
import com.cloud.servicegreyrelease2.service.GreyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class GreyServiceImpl implements GreyService {

    @Autowired
    private GreySettingMapper greySettingMapper;

    @Autowired
    private OnlineSettingMapper onlineSettingMapper;

    @Override
    public GreySetting queryGreySetting(String userId, String serviceName) {
        GreySetting greySetting = GreySetting.QueryBuild().userId(Integer.parseInt(userId)).serviceName(serviceName).inUse(1).build();
        return greySettingMapper.queryGreySettingLimit1(greySetting);
    }

    @Override
    public OnlineSetting queryOnLineSetting(String serviceName) {
        OnlineSetting onlineSetting = OnlineSetting.QueryBuild().serviceName(serviceName).inUse(1).build();
        return onlineSettingMapper.queryOnlineSettingLimit1(onlineSetting);
    }
}
